package com.lepu.app.fun.my;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.app.utils.LoginUtil;
import com.app.utils.MyStoreUtil;
import com.app.utils.Setting;
import com.app.utils.UmengEvent;
import com.core.lib.application.BaseFragmentActivity;
import com.core.lib.utils.main.UmengHelper;
import com.lepu.app.fun.health.activity.HealthWebActivity;
import com.lepu.app.widget.CustomTopBarNew;
import com.lepu.app.widget.CustomTopBarNew.OnTopbarNewLeftLayoutListener;
import com.lepu.pasm.R;

public class MyOrderActivity extends BaseFragmentActivity implements
		OnTopbarNewLeftLayoutListener {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.my_order_activity);

		init();
	}

	@Override
	public void onResume() {
		super.onResume();

		UmengHelper.onResume(this, UmengEvent.page_wodedingdan);
	}

	@Override
	public void onPause() {
		super.onPause();

		UmengHelper.onPause(this, UmengEvent.page_wodedingdan);
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
	}

	/**
	 * 添加页面动画，需要重写这个方法，
	 */
	@Override
	public void onBackPressed() {
		finish(true);
	}
	
	@Override
	public void onTopbarLeftLayoutSelected() {
		finish(true);
	}

	/**
	 * 初始化方法
	 */
	private void init() {
		// topbar
		CustomTopBarNew topbar = (CustomTopBarNew) findViewById(R.id.topbar);
		topbar.setTopbarTitle("我的订单");
		topbar.setonTopbarNewLeftLayoutListener(this);
	}

	public void viewClick(View view)
	{
		int rid = view.getId();
		switch (rid){
			case R.id.peiZhenLayout:

				if(!LoginUtil.jumpLogin(this))
				{
					Intent intent = new Intent(this, HealthWebActivity.class);
					intent.putExtra("url", Setting.getSuiXinZhenMainUrl());
					intent.putExtra("title", getString(R.string.health_title_pei_zhen_order));
					intent.putExtra("type", HealthWebActivity.TYPE_ORDER_PEI_ZHEN);
					startActivity(intent, true);
				}

				break;
			case R.id.zhuanZhenLayout:

				if(!LoginUtil.jumpLogin(this))
				{
					Intent intentZhuanZhen = new Intent(this, HealthWebActivity.class);
					intentZhuanZhen.putExtra("url", Setting.getZhuanZhenMainUrl());
					intentZhuanZhen.putExtra("title",getString(R.string.health_title_zhuan_zhen_order));
					intentZhuanZhen.putExtra("type", HealthWebActivity.TYPE_ORDER_ZHUAN_ZHEN);
					startActivity(intentZhuanZhen, true);
				}

				break;
			case R.id.scoreOrderLayout:

				UmengHelper.CustomEvent(this, UmengEvent.event_wode_wodedingdan_duihuanjilu);

				MyStoreUtil.getInstance().requestSign(this);
				break;
			case R.id.marketOrderLayout:

				UmengHelper.CustomEvent(this, UmengEvent.event_wode_wodedingdan_shangchengdingdan);

				MyStoreUtil.getInstance().requestMarketOrder(this, "");
				break;

			default:
				break;
		}
	}

}
